<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/2/11
 * Time: 11:53
 */

namespace app\admin\controller;


class Fileupload extends Base
{
    public function index()
    {
        $file = $this->request->file('file');
//        保存图片
        $res = $file->move('../public/static/upload');
        if ($res) {
            return $this->ajaxSuccess('上传成功', 1, ['path' => $res->getSaveName()]);
        } else {
            return $this->ajaxError('上传失败');
        }
    }
}